package com.kinon.tyjaccount.tools;

import android.text.format.DateFormat;

/**
 * Created by luohao on 2017-07-25.
 */

public class SysTimeManage {

    public static SysTimeManage timeManage=null;

    public static  SysTimeManage getInstage(){
       if(timeManage==null){
           timeManage=new SysTimeManage();
       }
       return timeManage;
    }

    public String getDateTime( long sysTime){
        CharSequence timeStr= DateFormat.format("yyyy-MM-dd HH:mm:ss", sysTime);
        return timeStr.toString();
    }

    public String getDate(long sysTime){
        CharSequence timeStr= DateFormat.format("yyyy-MM-dd", sysTime);
        return timeStr.toString();
    }

    public String  getOrderId( long sysTime){
//        CharSequence timeStr= DateFormat.format("yyyyMMddHHmmss", sysTime);
        CharSequence timeStr= DateFormat.format("yyyyMMddHH", sysTime);
        return timeStr+String.valueOf(sysTime).substring(7);
    }

    public String  getYMD( long sysTime){
        CharSequence timeStr= DateFormat.format("yyyyMMdd", sysTime);
        return timeStr+String.valueOf(sysTime);
    }

    public int  getOrderType( long sysTime){
        CharSequence timeStr= DateFormat.format("HHmmss", sysTime);
        String hh= timeStr.toString().substring(0,2);
        int hors=Integer.parseInt(hh);
        int type=0;
        if(hors<11){
            type=0;
        }else{
            type=2;
        }
        return type;
    }
}
